# Remove a RabbitMQ queue
#
# Required parameter:
#   - queue_name (str): the name of the queue to delete.
#   - vhost (str): the name of the RabbitMQ virtual host
#
# Use --extra-vars to define them.

- assert:
    that:
      - "queue_name is defined"
    fail_msg: "You must define queue_name"

- assert:
    that:
      - "vhost is defined"
    fail_msg: "You must define vhost"
 
- name: Create the queue in RabbitMQ
  hosts: rabbitmq_stg[0]:rabbitmq[0]
  rabbitmq_queue:
    name: "{{ queue_name }}"
    vhost: "{{ vhost }}"
    state: absent
    login_user: admin
    login_password: "{{ (env == 'production')|ternary(rabbitmq_admin_password_production, rabbitmq_admin_password_staging) }}"
